home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vbcred1a
/
frmmain.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1999-08-28
|
3KB
|
80 lines
VERSION 5.00
Begin VB.Form frmMain
BackColor = &H00000000&
BorderStyle = 1 'Fixed Single
Caption = "VBCredits"
ClientHeight = 5265
ClientLeft = 45
ClientTop = 330
ClientWidth = 6195
BeginProperty Font
Name = "Fixedsys"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 351
ScaleMode = 3 'Pixel
ScaleWidth = 413
StartUpPosition = 3 'Windows Default
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' The credits object
Dim myCredits As New cCredits
Private Sub Form_Load()
' Frame limiter
Dim CurTime As Long, NextTime As Long
' ALWAYS make sure the form is shown before entering a loop
Me.Show
' 50ms between frames (If the system can handle it)
NextTime = timeGetTime() + 50
' Set the Y position of the credits
myCredits.PosY = Me.ScaleHeight
' This loads the text in the text file into the VBCredits strings
Call LoadTXT
' Center align the text
SetTextAlign Me.hDC, TA_CENTER
' Do until the program ends
Do While DoEvents()
' Get the current time
CurTime = timeGetTime()
' If the time is right to execute the next frame
If CurTime >= NextTime Then
' Clear the screen
Me.Cls
' Move the credits at a speed of 1 pixel
myCredits.Move -1
' Draw the credits onto the form
myCredits.Draw Me.hDC, Me.ScaleWidth, Me.ScaleHeight
' Set when the next frame should be executed
NextTime = CurTime + 50
End If
Loop
End Sub
Public Sub LoadTXT()
' Resize the strings array to no strings
ReDim Strings(0)
' Open the text file
Open App.Path & "\credits.txt" For Input As #1
' Repeat until the end of the file
Do Until EOF(1)
' Resize the array preserving the current entries
ReDim Preserve Strings(UBound(Strings) + 1)
' Load in the string
Input #1, Strings(UBound(Strings))
Loop
Close #1
End Sub